@var userOffice = office.getUserOfficeList(); //用户持有的机构
@var userRoles = role.getUserRoleList(); //用户角色
<div class="tabbable">
	<ul class="nav nav-tabs" id="myTab">
		<li class="active">
		<a data-toggle="tab" href="#home"> 
			<i class="green ace-icon fa fa-users bigger-120"></i> 用户列表
		</a>
		</li>

		<li class=""><a data-toggle="tab" href="#profile"> 
		<i class="green ace-icon fa fa-plus bigger-120"></i> 用户添加
		</a></li>
	</ul>

	<div class="tab-content">
		<div id="home" class="tab-pane active clearfix">
			<#search>
				<form action="${ctxPath}/sysuser/list" method="post" id="search-form" 
				target="list-page" class="center clearfix">
				<div class="row padding-tb-10">
					<div class="col-sm-6">
						<label class="inline">归属机构：</label>
						<#pullDownTree order="one" treeData="${userOffice}" name="officeId" 
							class="width-80" cName="officeType" >
							$("#pullDownTreeCurCidone").val(treeNode.type);
						</#pullDownTree>
					</div>
					<div class="col-sm-6">
						<label class="inline">真实姓名：</label>
						<input type="text" class="width-80"  name="name"/>
					</div>
				</div>
				<div class="row padding-tb-10">
					<div class="col-sm-6">
						<label class="inline">所属角色：</label>
						<select name="roles" multiple class="chosen-select tag-input-style" id="role-select" data-placeholder="选择角色">
							@for(role in userRoles){
								<option value="${role.id!}">
								${role.name!}
								@var sostr = office.getOfficeStrByOfficeId(role.officeId);
								@if(!isEmpty(sostr)){
								&nbsp;(${sostr})
								@}
								</option>
							@}
						</select>
					</div>
					<div class="col-sm-6">
						<label class="inline">人员工号：</label>
						<input type="text" class="width-80"  name="no"/>
					</div>
				</div>
				<div class="padding-trb-10 col-sm-12">
					<span class="btn  btn-primary btn-sm col-sm-6" onclick="$curmenu.trigger('click');">全 部 用 户</span>
					<span class="btn btn-info btn-sm col-sm-6" id="search-btn">条 件 查 询</span>
				</div>
				</form>
			</#search>
			<div class="space-6"></div>
			<div id="list-page"></div>
		</div>

		<div id="profile" class="tab-pane">
			<form action="${ctxPath!}/sysuser/save" method="post" id="sysuser-save-form">
				<div class="center padding-10">
					<label>登录名：</label>
					<input type="text" class="width-50" name="username" id="username"
					ajaxurl="${ctxPath!}/sysuser/checkname" datatype="*"  nullmsg="请输入登录名！" />
				</div>
				<div class="center padding-10">
					<label>密码：</label>
					<input type="password" class="width-50" name="password" 
					datatype="*6-16" errormsg="密码范围在6~16位之间！" nullmsg="请输入密码！" />
				</div>
				<div class="center padding-10">
					<label>确认密码：</label>
					<input type="password" class="width-50" name="repassword" 
					 datatype="*" recheck="password" errormsg="您两次输入的密码不一致！" nullmsg="请输入确认密码！"/>
				</div>
				<div class="center padding-10">
					<label>真实姓名：</label>
					<input type="text" class="width-50" name="name" datatype="*"  nullmsg="请输入姓名！"/>
				</div>
				<div class="center padding-10">
					<label>归属机构：</label>
					<div class="width-50 inline text-left" id="gsoffice">
						<#pullDownTree order="two" treeData="${userOffice}" name="officeId" 
							class="width-100" isRoot="false" rootNodeName="请选择归属机构" />
					</div>
				</div>
				<div class="center padding-10" >
					<label>所属角色：</label>
					<div class="width-50 inline text-left">
						<select name="roleIds" multiple class="chosen-select tag-input-style" id="role-choose" data-placeholder="选择角色">
						@for(role in userRoles){
							<option value="${role.id!}">
							${role.name!}
							@var sostr = office.getOfficeStrByOfficeId(role.officeId);
							@if(!isEmpty(sostr)){
								&nbsp;(${sostr})
							@}
							</option>
						@}
						</select>
					</div> 
				</div>
				<div class="center padding-10">
					<label>工号：</label>
					<input type="text" class="width-50" name="no"/>
				</div>
				<div class="center padding-10">
					<label>邮箱：</label>
					<input type="text" class="width-50" name="email" />
				</div>
				<div class="center padding-10">
					<label>电话：</label>
					<input type="text" class="width-50" name="phone"/>
				</div>
				<div class="center padding-10">
					<label>手机：</label>
					<input type="text" class="width-50" name="mobile"/>
				</div>
				<div class="center padding-10" >
					<label style="vertical-align: top;">描述：</label>
					<textarea type="text" class="width-50" name="remarks"></textarea>
				</div>
				<div class="margin-t15">
					<span class="btn btn-info btn-block bigger-120" id="sysuser-save-btn">保 存</span>
				</div>
			</form>
		</div>
	</div>
</div>
<style>
#profile .center>label{width: 100px;text-align: right;}
</style>
<#save isHide="yes" subBtnId="sysuser-save-btn" formId="sysuser-save-form" 
validId="sysuserForm" config="true">
	sysuserForm.config({
		beforeCheck:function(curform){
			var flag = $("#username")[0].validform_valid;
			if(flag != "true" && $.trim($("#username").val())!=""){
				 $("#username")[0].focus();
				 tip.errorTip(flag,$("#username"));
				 return false;
			}
		},
		beforeSubmit:function(curform){
			var office = $("#pullDownTreeCurIdtwo");
			if($.trim(office.val())=="" || office.val() == 0){
				tip.errorTip("请选择归属机构",$("#gsoffice"));
				return false;
			}
		}
	});
</#save>
<script>
	$("#role-select").chosen({width: "80%",search_contains: true});
	$("#role-choose").chosen({width: "100%",search_contains: true}); 
	$("#search-form").getPageList({'submitBtnId':'search-btn'});
</script>
